package com.svse.designPattern.liskovsubstitutionprinciple;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/7/26 9:24
 */
public class ISPtEST2 {
    public static void main(String[] args) {
        Animal animal=new Swallow1();
        Animal anima2=new Swallow1();
        animal.setRunSpeed(120);
        anima2.setRunSpeed(60);
        System.out.println("如果飞行300公里：");
        System.out.println("燕子将飞行"+animal.getRunTime(300)+"小时.");
        System.out.println("几维鸟将跑"+anima2.getRunTime(300)+"小时。");
    }
}
class Animal{
    double runSpeed;

    public void setRunSpeed(double runSpeed) {
        this.runSpeed = runSpeed;
    }
    double getRunTime(double distince){
        return distince/runSpeed;
    }
}

//鸟类
class Bird1 extends Animal
{
    double flySpeed;
    public void setSpeed(double speed)
    {
        flySpeed=speed;
    }
    public double getFlyTime(double distance)
    {
        return(distance/flySpeed);
    }
}
//燕子类
class Swallow1 extends Bird1{}
//几维鸟类
class BrownKiwi1 extends Animal
{

}
